import request from '@/utils/request'

//分页查询保养预约
export const queryPageApi = (userName, plateNumber, status, beginDate, endDate, page, pageSize) => request.get(`/appointments/maintenance?userName=${userName}&plateNumber=${plateNumber}&status=${status}&beginDate=${beginDate}&endDate=${endDate}&page=${page}&pageSize=${pageSize}`)

//更新保养预约状态
export const updateStatusApi = (data) => request.put(`/appointments/maintenance/status?id=${data.id}&status=${data.status}`)

//批量删除保养预约
export const deleteBatchApi = (ids) => request.delete(`/appointments/maintenance?ids=${ids}`)

//获取保养预约详情
export const queryInfoApi = (id) => request.get(`/appointments/maintenance/${id}`)

//新增保养预约
// 保养预约API
export const addMaintenanceAppointmentApi = (data) => request.post('/appointments/maintenance', data)
// 维修预约API
export const addRepairAppointmentApi = (data) => request.post('/appointments/repair', data)

//更新保养预约
export const updateAppointmentApi = (data) => request.put('/appointments/maintenance', data)

//检查预约时间是否可用（保养预约）
export const checkMaintenanceTimeAvailableApi = (date, time) => request.get(`/appointments/maintenance/check-time?date=${date}&time=${time}`)

//检查预约时间是否可用（维修预约）
export const checkRepairTimeAvailableApi = (date, time) => request.get(`/appointments/repair/check-time?date=${date}&time=${time}`)